# 基础镜像
FROM alpine

# 镜像维护者
MAINTAINER alpine-frpc Docker Image "enovo458@126.com" author "drophair"

ENV FRP_VERSION 0.38.0
WORKDIR /

# alpine更换 阿里 镜像源
RUN echo "http://mirrors.aliyun.com/alpine/latest-stable/main/" > /etc/apk/repositories && \
    echo "http://mirrors.aliyun.com/alpine/latest-stable/community/" >> /etc/apk/repositories

RUN apk update && \
    apk add --no-cache ca-certificates && \
    apk add --no-cache curl bash tzdata && \
    apk add --no-cache wget && \
    cp -rf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

RUN set -x && \
	if [ "$(uname -m)" = "x86_64" ]; then export PLATFORM=amd64 ; else if [ "$(uname -m)" = "aarch64" ]; then export PLATFORM=arm64 ; fi fi && \
    echo "OK" && \
	wget --no-check-certificate https://ghproxy.com/github.com/fatedier/frp/releases/download/v${FRP_VERSION}/frp_${FRP_VERSION}_linux_${PLATFORM}.tar.gz && \ 
	tar xzf frp_${FRP_VERSION}_linux_${PLATFORM}.tar.gz && \
	cd frp_${FRP_VERSION}_linux_${PLATFORM} && \
	mkdir /frp && \
	mv frpc frpc.ini /frp && \
	cd .. && \
	rm -rf *.tar.gz frp_${FRP_VERSION}_linux_${PLATFORM}

VOLUME /frp


CMD /frp/frpc -c /frp/frpc.ini